package com.boot.mgt.controller.app

import com.boot.core.result.ResultTo
import com.boot.mgt.service.TaAccidentStatisticsService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.util.*


/**
 * APP统计
 * @author rankai on 2018/3/22.
 */
@RestController
@RequestMapping("/app/statistics")
class TaAppAccidentStatisticsController {

    @Autowired
    lateinit var taAccidentStatisticsService: TaAccidentStatisticsService

    @GetMapping("/accident_map_all")
    fun accidentMapAll(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") start_time: Date,
                       @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") end_time: Date): ResultTo {
        return taAccidentStatisticsService.accidentMapAll(start_time, end_time)
    }

    @GetMapping("/accident_map_all_rpc")
    fun accidentMapAllRpc(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") start_time: Date,
                       @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") end_time: Date, police_number: String?): ResultTo {
        return taAccidentStatisticsService.accidentMapAllRpc(start_time, end_time, police_number)
    }

    @GetMapping("/accident_map_old")
    fun accidentMapOld(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") start_time: Date,
                       @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") end_time: Date): ResultTo {
        return taAccidentStatisticsService.accidentMapOld(start_time, end_time)
    }

    @GetMapping("/accident_map_old_rpc")
    fun accidentMapOldRpc(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") start_time: Date,
                       @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") end_time: Date, org_num: String?): ResultTo {
        return taAccidentStatisticsService.accidentMapOldRpc(start_time, end_time, org_num)
    }


}